home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / common / calc_cop.c4 < prev    next >
Text File  |  2002-09-09  |  1KB  |  42 lines

  1.       
  2. {
  3.   @calc_cop {
  4.     resid Player;
  5.     resid Game;    
  6.     int nav_getting_pulled_over;
  7.     int chance_speeding_pullover;
  8.     int chance_chains_pullover;    
  9.     int tmp_int;
  10.     Game   = ResByName("Game"); 
  11.     Player = ResPropGetResID(Game,"game_cur_player");
  12.  
  13.     ResPropAlias(Game,"game_chance_chains_pullover","chance_chains_pullover");
  14.     ResPropAlias(Game,"game_chance_speeding_pullover","chance_speeding_pullover");
  15.     
  16.     
  17.     /* figure out if we should get a visit by the cops */
  18.     if (ResPropGetInt(Player,"truck_speeding") == 1) {        
  19.       tmp_int = Random(0,chance_speeding_pullover);
  20.     }
  21.     
  22.     if (tmp_int == 1 /* number pulled out of my bum */) {
  23.       ResPropSetInt(ResByName("dash.gl/SegmentController"),"state",9);
  24.       ResParseEvent(ResByName("dash.gl/brake_pedal"),"@activate");      
  25.       stop;
  26.     }
  27.     
  28.     if (( ResPropGetInt(Player,"truck_chains_on") == 1) && 
  29.           StrExact(ResPropGetStr(Player,"weather_weather"),"d") ) {
  30.       tmp_int = Random(0,chance_chains_pullover);
  31.     }
  32.     
  33.     if (tmp_int == 1 /* number pulled out of my bum */) {
  34.       CVarSetInt("guiInputEnabled",0);
  35.       ResPropSetInt(ResByName("dash.gl/SegmentController"),"state",9);
  36.       ResParseEvent(ResByName("dash.gl/brake_pedal"),"@activate");            
  37.       stop;
  38.     }
  39.   }
  40. }      
  41.       
  42.